<?php
require_once(dirname(__FILE__).'/config.php');
CheckPurview('plus_幻灯片管理');
require_once(DEDEINC.'/datalistcp.class.php');
require_once(DEDEINC.'/common.func.php');
setcookie('ENV_GOBACK_URL',$dedeNowurl,time()+3600,'/');

if($dopost=="uploadLitpic")
{
	$fname = $_GET['litpic'] ? $_GET['litpic'] : 'litpic';
    $upfile = AdminUpload($fname, 'imagelit', 0, true );
    if($upfile=='-1')
    {
        $msg = "<script language='javascript'>
                parent.document.getElementById('uploadwait').style.display = 'none';
                alert('你没指定要上传的文件或文件大小超过限制！');
            </script>";
    }
    else if($upfile=='-2')
    {
        $msg = "<script language='javascript'>
                parent.document.getElementById('uploadwait').style.display = 'none';
                alert('上传文件失败，请检查原因！');
            </script>";
    }
    else if($upfile=='0')
    {
        $msg = "<script language='javascript'>
                parent.document.getElementById('uploadwait').style.display = 'none';
                alert('文件类型不正确！');
            </script>";
    }
    else
    {
        $msg = "<script language='javascript'>
                    parent.document.getElementById('uploadwait').style.display = 'none';
                    parent.document.getElementById('{$_GET[picname]}').value = '{$upfile}';
                    if(parent.document.getElementById('{$_GET[divpicview]}'))
                    {
                        parent.document.getElementById('{$_GET[divpicview]}').style.width = '150px';
                        parent.document.getElementById('{$_GET[divpicview]}').innerHTML = \"<img src='{$upfile}' width='150' />\";
                    }
                </script>";
    }
    echo $msg;
    exit();
}

function GetFlashTypeName($id)
{
	global $dsql;
	$row = $dsql->GetOne("Select * From `#@__flashtype` where id='$id'");
	$typename = $row['typename'];
	if($typename=="")
	{
		$typename="默认分类";
	}
	return  $typename;
}
if(!empty($tid))
{
	$sql = "Select * from `#@__flash` where typeid='{$tid}'  order by sortrank asc";
}
else
{
	$sql = "Select * from `#@__flash` order by id desc";
}

$dlist = new DataListCP();
$dlist->SetTemplet(DEDEADMIN."/templets/flash_main.htm");
$dlist->SetSource($sql);
$dlist->display();
?>